import cookies from 'js-cookie'

/**
 * 保存 jwt accessToken
 * @param accessToken
 * @param refreshToken
 */
export function saveTokens (accessToken: string, refreshToken: string): void {
  cookies.set('access_token', `Bearer ${accessToken}`)
  cookies.set('refresh_token', `Bearer ${refreshToken}`)
}

/**
 * 获取 jwt accessToken
 */
export function getTokens (): any {
  return cookies.get('access_token')
}

/**
 * 移除登录信息
 */
export function removeToken (): void {
  cookies.remove('access_token')
  cookies.remove('refresh_token')
}
